GBML manual / Using the editor

The Code tab

Where objects, scripts and events are authored - the project browser, the object editor, and one tab per open event.

Three panes

The Code tab is a project browser on the left, an editor in the middle, and the manual pane on the right (opened by middle-click or F1 - see Objects and instances for what a click under the pointer can jump to). The in-editor Help Center's own Code tab topic covers the same ground from the tool's side, step by step, if you would rather read it there than here.

Canvases

Every window you open for an object (its settings and its events) or for a script - and the Globals, Macros and Room Creation Code windows - lives on a canvas. A canvas is a tab in the row at the top of the middle of the Code tab, beside any docked tabs. Canvas 1 is always there and cannot be closed. + New Canvas adds Canvas 2, then Canvas 3, and so on: it takes the lowest number that is free, so after you close Canvas 2 the next new canvas is Canvas 2 again. A canvas is never renamed. Canvases take room in the row like docked tabs do, so when there is no room for another, Gbabel says Too many docked at once. Closing a canvas (its ✕) closes its windows. Nothing is lost: your code is saved in the project as always.

Windows open on the canvas you were last looking at. If a docked tab, or another tab of Gbabel, is in front when you open one, Gbabel shows that canvas first. If the window is already open on another canvas, Gbabel takes you to that canvas and makes the window glow for a moment, so there is never a second copy of it. To move a window, right-click its top bar and choose Move to Canvas 2 (or whichever canvas you want); an object takes its event window with it.

A canvas works like the Room Editor. The mouse wheel over empty ground, or over a window's top bar, zooms toward the pointer (hold Ctrl or pinch to zoom from anywhere; over a window's code the wheel scrolls the code). Drag empty ground, or hold the middle button, to move around. On a laptop, tick Laptop mode in File > Preferences, then hold Ctrl and move the mouse to move around (with it off, holding Ctrl never moves the view). Space fits every window in view - but while you are typing in a text box or in the code, Space is just a space. The windows are drawn bigger or smaller as you zoom, and they are cut off at the edge of the canvas. You cannot drag a window out of its canvas; move the canvas instead. Gbabel remembers your canvases, the windows on them, where they are, and how each canvas is zoomed for each project.

The ⊟ button on a window docks it as a tab and takes it off the canvas. ⊞ Pop out turns the docked tabs back into windows on the canvas you were last on. Behaviors, HUD & Menus and Player movement are not on a canvas: each opens as a docked tab of its own.

Docking event tabs

An event opens in its own window on the canvas, beside its object's window. The ⊟ button on an event window (or on the object window, for every event of that object that is open) docks it as a tab in the middle of the tab. Only event tabs dock. Each docked tab wears its object's color; right-click the object in the list and choose Docked color... to pick another. When many tabs are docked they shrink, and when there is no room for one more Gbabel says Too many docked at once. Ctrl+Left / Ctrl+Right switch tabs, and Ctrl+Alt+Left / Ctrl+Alt+Right do it inside the code, where plain Ctrl+Left jumps a word.

Each section of the left panel has its buttons in a row under its name, and a ⊞ button that pops the section out into its own window.

Problems, Output and budgets

A strip along the bottom shows compile Problems (file, line, and a click that opens the exact spot), an Output log, and - for whichever room is currently open in the Room Editor tab - its sprite, palette and pool readings. See Building and reading its problems for what a Problems row actually looks like and how it maps back to a .gbml file and line.

Shortcuts, checked against the running editor

The table below reflects what this build's code actually does, not just what was planned - two real gaps were found this pass, both worth knowing before relying on the keyboard alone:

KeyActionNote
Ctrl+BBuild and runworks from any tab, including outside the code editor
F5Build and runworks from anywhere in the editor, not just the Code tab. It never reloads the page - Gbabel takes the key before the browser sees it. It stands down in two cases, so a build is never started by accident: while you are typing in a text field, and while an embedded editor (Paint, the tracker) has the keyboard
Ctrl+SSave the project
Ctrl+F / Ctrl+HFind / replace in the open event
Ctrl+TGo to anything
Ctrl+GGo to line
Ctrl+SpaceCompletion
F9 / F8Bigger / smaller code textevery code editor changes together, and Gbabel remembers the size (8 to 32; 13 to start)
Ctrl+KCommentworks in both editor engines
Ctrl+Shift+KUncommentworks in the fallback text editor; not yet wired in the CodeMirror engine, which is the default today - use the gutter or retype the //
Ctrl+M, F / Ctrl+M, UFold / unfold regionsworks in the fallback text editor. In the normal editor there is no key for it yet — click the − next to the line number instead
F1, middle-clickDefinition or manual page
Ctrl+clickDefinition or manual pageworks in the fallback text editor; not yet wired in the CodeMirror engine - use middle-click or F1 instead
Alt+← / Alt+→Back / forward through jumps
Ctrl+← / Ctrl+→Previous / next event tabin the code editor use Ctrl+Alt+← / Ctrl+Alt+→ instead
Ctrl+Shift+BText ⇄ Blocksreal today - see Blocks and code for what the Blocks pane does

The three CodeMirror gaps above are not a documentation guess - they are an absence of any matching key handler in the editor's own source, confirmed by reading it directly. If a later build wires them up, this row should simply be deleted rather than left describing a fixed gap as still open.

See also: Events in the editorBlocks and codeBuilding code with blocksWhat GBML isObjects and instances